<template>
    <div class="studentifo">
        <h3 v-text="msg"></h3>
        <p>学校名：{{name}}</p>
        <p>地址：{{address}}</p>
        <button @click="sendAddress">向父组件传递学校地址</button>
        <button @click="sendStudent">传递学校名</button>
        <!-- <button @click="sendName1">将msg传递给app</button> -->
    </div>
</template>

<script>
export default {
    name:"School",
    data(){
        return {
            msg:"学校信息",
            name:'TJCU',
            address:'天津'
        }
    },
    methods:{
        sendStudent(){
            this.$bus.$emit('hello',this.name)
        },
        sendAddress(){
            this.$emit('showSchool',this.address)
        },
        // sendName1(){
        //     this.$bus.$emit('showMsg',this.name)
        // }
    }
}
</script>

<style>
    .studentifo{
        background-color: black;
    }
</style>
